﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace Imgur.Net.Auth
{
    [Serializable]
    public class LoginException : Exception
    {
        public LoginException()
        {
        }

        public LoginException(string message) : base(message)
        {
        }

        public LoginException(string message, Exception innerException) : base(message, innerException)
        {
        }

        protected LoginException(SerializationInfo info, StreamingContext context) : base(info, context)
        {
        }

        protected bool Equals(LoginException other)
        {
            return string.Equals(Message, other.Message) && Equals(InnerException, other.InnerException);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((LoginException) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return ((Message != null ? Message.GetHashCode() : 0)*397) ^ (InnerException != null ? InnerException.GetHashCode() : 0);
            }
        }

        public static bool operator ==(LoginException left, LoginException right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(LoginException left, LoginException right)
        {
            return !Equals(left, right);
        }
    }
}
